{extend name="public/layout" /}
{block name="title"}用户登录{/block}
{block name="head"}
<style>
    body{background:#f4f4f4;}
    .weui-cells:after{border: none;}
    .weui-cell{background: #fff;margin-bottom: 15px;border-radius: 10px;padding:12px 15px;}
    .weui-cells{background:#f4f4f4;margin-top: 0px;font-size:14px;}
    .weui-label{width: 80px;}
</style>
{/block}
{block name="body"}
<h1 style="text-align:center;font-size:18px;height：55px;line-height: 55px;font-weight: 500;">用户登录</h1>
<form id="loginForm" onSubmit="return doLogin();">
    <input type="hidden" name="reback" value="{$reback}" />
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">手机号码</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="number" required name="member_mobile" placeholder="请输入手机号">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="password" required name="member_pass" placeholder="请输入密码">
            </div>
        </div>
        <button type="submit" class="weui-btn weui-btn_primary">登录</button>
        <a href="{:url('userReg')}" style="float: right;margin-right: 15px;margin-top: 15px;color: blue;">还没账号？去注册</a>
    </div>
</form>
<script>
    function doLogin() {
        $.post("{:url('userLogin')}",$('#loginForm').serialize(),function (res) {
            if(res.code==1){
                location.href=res.url;
            }else{
                alert(res.msg);
            }
        });
        return false;
    }
</script>
{/block}